package org.codefinger.json.parser.deserializer;

import java.math.BigDecimal;

import org.codefinger.json.parser.JSONArrayDeserializer;
import org.codefinger.json.parser.JSONDeserializer;
import org.codefinger.json.parser.JSONLexer;
import org.codefinger.json.parser.JSONObjectDeserializer;

public class DeserializerForBigDecimal implements JSONDeserializer {

	public static final DeserializerForBigDecimal	INSTANCE	= new DeserializerForBigDecimal();

	private DeserializerForBigDecimal() {

	}

	
	@Override
	public Object stringValue(String value) {
		return  new BigDecimal(value);
	}

	
	@Override
	public Object stringValue(JSONLexer jsonLexer) {
		return  new BigDecimal(jsonLexer.getOriginalString());
	}

	
	@Override
	public Object intValue(String value) {
		return  new BigDecimal(value);
	}

	
	@Override
	public Object floatValue(String value) {
		return  new BigDecimal(value);
	}

	
	@Override
	public Object falseValue() {
		return  new BigDecimal("0");
	}

	
	@Override
	public Object trueValue() {
		return  new BigDecimal("1");
	}

	@Override
	public JSONArrayDeserializer createArrayDeserializer() {
		return ArrayDeserializerForNull.INSTANCE;
	}

	@Override
	public JSONObjectDeserializer createObjectDeserializer() {
		return ObjectDeserializerForNull.INSTANCE;
	}

}
